#!/user/bin/python3
# @Author:  LSY
# @Date:    2020/11/8
from app.models.bo.hanfan.hanfan_model_input_bo import HanFanModelInputBO
from app.services.models.base_model import BaseModel
from app.services.models.pickle_model import PickleModel
from flask import current_app
import pandas as pd
import numpy as np
from app.utils.constant import HanFanStatus


class HanfanVModel(BaseModel):

    def __init__(self):
        super().__init__(model_name="hanfan_v_model")

    def process(self, input):
        try:
            a1 = input.get("CG_LT_GL_GL04_Tie_V", 0)
            a2 = input.get("CG_LT_GL_GL04_Tie_Ni", 0)
            a3 = input.get("CG_LT_GL_GL04_Zha_Al2O3", 0)
            a4 = input.get("CG_LT_GL_GL04_Zha_TiO2", 0)
            a5 = input.get("CG_LT_GL_GL04_Zha_V2O5", 0)
            a6 = input.get("CG_LT_GL_GL04_LDWDBTE1130_XB_Zhong5963", 0)
            a7 = input.get("CG_LT_GL_GL04_LJWDBTE1101_Zhong_4000", 0)
            a8 = input.get("CG_LT_GL_GL04_LDWDBTE1116_Zhong_Zhongxin5963", 0)
            y_V = 0.044 + a1 * 0.836 - a2 * 0.141 - a3 * 0.000362 + a4 * 0.000278 + a5 * 0.002 - a6 * 0.0000373 + a7 * 0.000169 - a8 * 0.000023
            return y_V
        except Exception as e:
            current_app.logger.info(e,exc_info=1)
            return 0


hanfan_v_model = HanfanVModel()
